public class Demo15 {
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            long startTime = System.currentTimeMillis();
            try {
                Thread.sleep(2000);
                long endTime = System.currentTimeMillis();
                System.out.println("休眠时间：" + (endTime - startTime));
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });

        t1.start();
    }
}
